package cn.virens.common;

import java.io.IOException;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

import cn.virens.util.ResourceUtil;

@Configuration
public class PropertiesConfig {

	/** 注入配置文件 */
	@Bean("propertyPlaceholderConfigurer")
	public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() throws IOException {
		PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
		configurer.setLocations(ResourceUtil.getResources("classpath:config/*.properties"));
		configurer.setIgnoreUnresolvablePlaceholders(true);

		return configurer;
	}
}
